package com.ims.controller;

import com.ims.pojo.UserLog;
import com.ims.service.UserLogService;
import com.ims.util.PageResult;
import com.ims.util.QueryPageBean;
import com.ims.util.Result;
import com.ims.util.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: zk
 * @date: 2022/9/10 17:00
 */
@RestController
@RequestMapping("/userLog")
public class UserLogController {

    @Autowired
    private UserLogService userLogService;

    @GetMapping("/findAll")
    public Result<List<UserLog>> findAll() {
        List<UserLog> userLogList = userLogService.list();
        return new Result<>(true, StatusCode.OK, "查询所有用户日志成功", userLogList);
    }

    @PostMapping("/findPage")
    public Result<PageResult> findPage(@RequestBody QueryPageBean queryPageBean) {
        PageResult<UserLog> pageResult = userLogService.findPage(queryPageBean);
        return new Result<>(true, StatusCode.OK, "分页查询成功", pageResult);
    }
}
